<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>快乐减肥瘦身俱乐部</title>
    @include('home.default.index.head')
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"  />
    <meta content="telephone=no" name="format-detection"/>
    <meta name="theme-color" content="#DB1011">
    <meta name="msapplication-navbutton-color" content="#FFFFFF">
    <link rel="stylesheet" href="/home/default/css/index.css">
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?ccd3e1f44e7fe4269d1b302c980dbf6c";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</head>
<body>
<div class="g-doc">
    <header>
        <div class="swiper-container">
            <div class="swiper-wrapper">
                @foreach($category as $key=>$obj)
                    <div class="swiper-slide @if($key == 0) active @endif">
                        {{$obj->category}}
                    </div>
                @endforeach
                <div class="pagination" style="display: none;"></div>
                <!-- 如果需要滚动条 -->
                <div class="swiper-scrollbar"></div>
            </div>
        </div>
    </header>
    <div class="m-con">
        @foreach($category as $keyCate=>$objCate)
            <div class="m-con-item @if($keyCate == 0) active @endif">
                <div class="m-scroller">
                    @foreach($catelist[$objCate->category] as $key =>$obj)
                        <section class="m-list">
                            <a href="{{url('/detail',$obj->id)}}" title="{{$obj->title}}">
                                <div class="m-list-img">
                                    <img src="{{$obj->cover}}"/>
                                </div>
                                <div class="m-article">
                                    <div class="m-article-title">
                                        <span>{{$obj->title}}</span>
                                    </div>
                                    <div class="m-article-info">
                                        <div class="m-article-time">{{date('Y-m-d',strtotime($obj->created_at))}}</div>
                                        <div class="m-article-counts"><span class="iconfont"></span>{{$obj->view + mt_rand(1000,2000)}}次</div>
                                    </div>
                                </div>
                            </a>
                        </section>
                    @endforeach
                </div>
            </div>
        @endforeach
            <div class="m-sub-box">
                <div class="m-back-to-top">
                    <i class="m-icon-go-top"></i>
                </div>
            </div>
    </div>
</div>
</body>
<script src="//js.yiwqi.com/js/jquery-2.0.3.min.js"></script>
<script src="/home/default/js/zepto.min.js"></script>
<script src="/home/default/js/zepto.fx.js"></script>
<script src="/home/default/js/zepto.animate.alias.js"></script>

<script src="/home/default/js/idangerous.swiper.min-2.4.1.js"></script>
<script src="/home/default/js/backToTop.js"></script>
<script src="/home/default/js/resize.js"></script>
<script type="text/javascript" src="/home/default/js/index.js"></script>
<input type="hidden" id="page" value="0">
<input type="hidden" id="category_id" value="">
<input type="hidden" id="nav_id" value="0">
<script>
    $("#category_id").val($(".swiper-slide").eq(0).html().trim());
    $(".swiper-slide").each(function (index) {
        $(this).click(function () {
            $("#category_id").val($(this).html().trim());
            $("#nav_id").val(index);
        });
    });
    $(document).scroll(function(){
        if($(this).scrollTop() + $(window).height()>= $(document).height() - 200){
            $.post("{{url('ajaxData')}}",{
                page:$("#page").val(),
                category:$("#category_id").val(),
                '_token':'{{csrf_token()}}'
            },function (data) {
                $(".m-scroller").eq($("#nav_id").val()).append(data);
                $("#page").val(parseInt($("#page").val()) + 1);
            })
        }
    })
</script>
<script>
    (function(){
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        }
        else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

</html>